package com.pk.platform.domain.common;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.pk.platform.util.DateConverter;

public class Child implements Serializable {

	private String id; //主键
	
	private String childName; //姓名
	
	private String childNum; //编号
	
	private String sex; //性别
	
	private Date birthday; //出生日期
	
	private Date entranceTime; //入学时间
	
	private String parent; //家长
	
	private String phone; //联系电话
	
	private String address; //地址
	
	private String residence; //户籍
	
	private Integer status; //是否在读
	
	private Cla cla; //所属班级
	
	private Kindergarten kindergarten;
	
	private Set<ChildArrange> childArrangeSet = new HashSet<ChildArrange>();
	
	//计算学童多少周岁
	public static int computeAge(String childBirthday)
	{
		String today = DateConverter.getToday();
		int bY = DateConverter.getYearByDate(childBirthday);
		int bM = DateConverter.getMonthByDate(childBirthday);
		int bD = DateConverter.getDayByDate(childBirthday);
		int tY = DateConverter.getYearByDate(today);
		int tM = DateConverter.getMonthByDate(today);
		int tD = DateConverter.getDayByDate(today);
		int age = tY - bY;
		if(tM < bM || (tM == bM && tD < bD))
		{
			age -= 1;
		}
		return age;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getChildName() {
		return childName;
	}

	public void setChildName(String childName) {
		this.childName = childName;
	}

	public String getChildNum() {
		return childNum;
	}

	public void setChildNum(String childNum) {
		this.childNum = childNum;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Date getEntranceTime() {
		return entranceTime;
	}

	public void setEntranceTime(Date entranceTime) {
		this.entranceTime = entranceTime;
	}

	public String getParent() {
		return parent;
	}

	public void setParent(String parent) {
		this.parent = parent;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getResidence() {
		return residence;
	}

	public void setResidence(String residence) {
		this.residence = residence;
	}

	public Cla getCla() {
		return cla;
	}

	public void setCla(Cla cla) {
		this.cla = cla;
	}

	public Kindergarten getKindergarten() {
		return kindergarten;
	}

	public void setKindergarten(Kindergarten kindergarten) {
		this.kindergarten = kindergarten;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Set<ChildArrange> getChildArrangeSet() {
		return childArrangeSet;
	}

	public void setChildArrangeSet(Set<ChildArrange> childArrangeSet) {
		this.childArrangeSet = childArrangeSet;
	}
	
}
